<?php
/**
 * Created by PhpStorm.
 * User: lenvo
 * Date: 2018/7/11
 * Time: 23:31
 */

namespace app\merchant\controller;


use think\Request;

class Area extends App {
    protected $area_service = null;
    public function __construct(Request $request = null){
        parent::__construct($request);
        $this->area_service = new \app\merchant\service\Area();
    }

    public function child() {
        $pid = input("pid",0);
        $ret = $this->area_service->getChild($pid);
        if($ret->getCode() == \app\merchant\define\Merchant::$Code_Mer_Error) {
            return $this->ret->setCode(1)->setMsg($ret->getMsg())->toJson();
        }
        $area = $ret->getData("area");
        return $this->ret->setCode(0)->setData("records",$area)->toJson();
    }
}